a_star_search

Locates the next node in graph to get to a position Uses A* search algorithm Can use any sortable value type

deprecated
void
a_star_search
(
T
U
)

Parameters

graph GridWithWeights

The graph of nodes

start T

Starting position to go to

goal T

The end position

came_from T[T]

The positions between start and end

cost_so_far U[T]

Sum of weights (cost) to get to goal from start

Examples

GridWithWeights!(XY, int) grid = diagram4();

XY[XY] came_from;
int[XY] cost_so_far;
a_star_search(grid, XY(1, 4), XY(7, 8), came_from, cost_so_far);
XY[] path = reconstruct_path(came_from, XY(1, 4), XY(7, 8));

// TODO: asserts

Meta